home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / make-367.lha / make-3.67 / make.info-7 (.txt) < prev    next >
GNU Info File  |  1993-05-16  |  26KB  |  592 lines

  1. This is Info file make.info, produced by Makeinfo-1.54 from the input
  2. file make.texinfo.
  3.    This file documents the GNU Make utility, which determines
  4. automatically which pieces of a large program need to be recompiled,
  5. and issues the commands to recompile them.
  6.    This is Edition 0.42, last updated 14 May 1993, of `The GNU Make
  7. Manual', for `make', Version 3.66 Beta.
  8.    Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
  9. Foundation, Inc.
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.    Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided also
  15. that the section entitled "GNU General Public License" is included
  16. exactly as in the original, and provided that the entire resulting
  17. derived work is distributed under the terms of a permission notice
  18. identical to this one.
  19.    Permission is granted to copy and distribute translations of this
  20. manual into another language, under the above conditions for modified
  21. versions, except that the text of the translations of the section
  22. entitled "GNU General Public License" must be approved for accuracy by
  23. the Foundation.
  24. File: make.info,  Node: Command Variables,  Next: Directory Variables,  Prev: Standard Targets,  Up: Makefile Conventions
  25. Variables for Specifying Commands
  26. =================================
  27.    Makefiles should provide variables for overriding certain commands,
  28. options, and so on.
  29.    In particular, you should run most utility programs via variables.
  30. Thus, if you use Bison, have a variable named `BISON' whose default
  31. value is set with `BISON = bison', and refer to it with `$(BISON)'
  32. whenever you need to use Bison.
  33.    File management utilities such as `ln', `rm', `mv', and so on, need
  34. not be referred to through variables in this way, since users don't
  35. need to replace them with other programs.
  36.    Each program-name variable should come with an options variable that
  37. is used to supply options to the program.  Append `FLAGS' to the
  38. program-name variable name to get the options variable name--for
  39. example, `BISONFLAGS'.  (The name `CFLAGS' is an exception to this
  40. rule, but we keep it because it is standard.)  Use `CPPFLAGS' in any
  41. compilation command that runs the preprocessor, and use `LDFLAGS' in
  42. any compilation command that does linking as well as in any direct use
  43. of `ld'.
  44.    If there are C compiler options that *must* be used for proper
  45. compilation of certain files, do not include them in `CFLAGS'.  Users
  46. expect to be able to specify `CFLAGS' freely themselves.  Instead,
  47. arrange to pass the necessary options to the C compiler independently
  48. of `CFLAGS', by writing them explicitly in the compilation commands or
  49. by defining an implicit rule, like this:
  50.      CFLAGS = -g
  51.      ALL_CFLAGS = -I. $(CFLAGS)
  52.      .c.o:
  53.              $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
  54.    Do include the `-g' option in `CFLAGS', because that is not
  55. *required* for proper compilation.  You can consider it a default that
  56. is only recommended.  If the package is set up so that it is compiled
  57. with GCC by default, then you might as well include `-O' in the default
  58. value of `CFLAGS' as well.
  59.    Put `CFLAGS' last in the compilation command, after other variables
  60. containing compiler options, so the user can use `CFLAGS' to override
  61. the others.
  62.    Every Makefile should define the variable `INSTALL', which is the
  63. basic command for installing a file into the system.
  64.    Every Makefile should also define variables `INSTALL_PROGRAM' and
  65. `INSTALL_DATA'.  (The default for each of these should be
  66. `$(INSTALL)'.)  Then it should use those variables as the commands for
  67. actual installation, for executables and nonexecutables respectively.
  68. Use these variables as follows:
  69.      $(INSTALL_PROGRAM) foo $(bindir)/foo
  70.      $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
  71. Always use a file name, not a directory name, as the second argument of
  72. the installation commands.  Use a separate command for each file to be
  73. installed.
  74. File: make.info,  Node: Directory Variables,  Prev: Command Variables,  Up: Makefile Conventions
  75. Variables for Installation Directories
  76. ======================================
  77.    Installation directories should always be named by variables, so it
  78. is easy to install in a nonstandard place.  The standard names for these
  79. variables are:
  80. `prefix'
  81.      A prefix used in constructing the default values of the variables
  82.      listed below.  The default value of `prefix' should be `/usr/local'
  83.      (at least for now).
  84. `exec_prefix'
  85.      A prefix used in constructing the default values of the some of the
  86.      variables listed below.  The default value of `exec_prefix' should
  87.      be `$(prefix)'.
  88.      Generally, `$(exec_prefix)' is used for directories that contain
  89.      machine-specific files (such as executables and subroutine
  90.      libraries), while `$(prefix)' is used directly for other
  91.      directories.
  92. `bindir'
  93.      The directory for installing executable programs that users can
  94.      run.  This should normally be `/usr/local/bin', but write it as
  95.      `$(exec_prefix)/bin'.
  96. `libdir'
  97.      The directory for installing executable files to be run by the
  98.      program rather than by users.  Object files and libraries of
  99.      object code should also go in this directory.  The idea is that
  100.      this directory is used for files that pertain to a specific
  101.      machine architecture, but need not be in the path for commands.
  102.      The value of `libdir' should normally be `/usr/local/lib', but
  103.      write it as `$(exec_prefix)/lib'.
  104. `datadir'
  105.      The directory for installing read-only data files which the
  106.      programs refer to while they run.  This directory is used for
  107.      files which are independent of the type of machine being used.
  108.      This should normally be `/usr/local/lib', but write it as
  109.      `$(prefix)/lib'.
  110. `statedir'
  111.      The directory for installing data files which the programs modify
  112.      while they run.  These files should be independent of the type of
  113.      machine being used, and it should be possible to share them among
  114.      machines at a network installation.  This should normally be
  115.      `/usr/local/lib', but write it as `$(prefix)/lib'.
  116. `includedir'
  117.      The directory for installing header files to be included by user
  118.      programs with the C `#include' preprocessor directive.  This
  119.      should normally be `/usr/local/include', but write it as
  120.      `$(prefix)/include'.
  121.      Most compilers other than GCC do not look for header files in
  122.      `/usr/local/include'.  So installing the header files this way is
  123.      only useful with GCC.  Sometimes this is not a problem because some
  124.      libraries are only really intended to work with GCC.  But some
  125.      libraries are intended to work with other compilers.  They should
  126.      install their header files in two places, one specified by
  127.      `includedir' and one specified by `oldincludedir'.
  128. `oldincludedir'
  129.      The directory for installing `#include' header files for use with
  130.      compilers other than GCC.  This should normally be `/usr/include'.
  131.      The Makefile commands should check whether the value of
  132.      `oldincludedir' is empty.  If it is, they should not try to use
  133.      it; they should cancel the second installation of the header files.
  134.      A package should not replace an existing header in this directory
  135.      unless the header came from the same package.  Thus, if your Foo
  136.      package provides a header file `foo.h', then it should install the
  137.      header file in the `oldincludedir' directory if either (1) there
  138.      is no `foo.h' there or (2) the `foo.h' that exists came from the
  139.      Foo package.
  140.      The way to tell whether `foo.h' came from the Foo package is to put
  141.      a magic string in the file--part of a comment--and grep for that
  142.      string.
  143. `mandir'
  144.      The directory for installing the man pages (if any) for this
  145.      package.  It should include the suffix for the proper section of
  146.      the manual--usually `1' for a utility.
  147. `man1dir'
  148.      The directory for installing section 1 man pages.
  149. `man2dir'
  150.      The directory for installing section 2 man pages.
  151. `...'
  152.      Use these names instead of `mandir' if the package needs to
  153.      install man pages in more than one section of the manual.
  154.      *Don't make the primary documentation for any GNU software be a
  155.      man page.  Write a manual in Texinfo instead.  Man pages are just
  156.      for the sake of people running GNU software on Unix, which is a
  157.      secondary application only.*
  158. `manext'
  159.      The file name extension for the installed man page.  This should
  160.      contain a period followed by the appropriate digit.
  161. `infodir'
  162.      The directory for installing the info files for this package.  By
  163.      default, it should be `/usr/local/info', but it should be written
  164.      as `$(prefix)/info'.
  165. `srcdir'
  166.      The directory for the sources being compiled.  The value of this
  167.      variable is normally inserted by the `configure' shell script.
  168.    For example:
  169.      # Common prefix for installation directories.
  170.      # NOTE: This directory must exist when you start the install.
  171.      prefix = /usr/local
  172.      exec_prefix = $(prefix)
  173.      # Where to put the executable for the command `gcc'.
  174.      bindir = $(exec_prefix)/bin
  175.      # Where to put the directories used by the compiler.
  176.      libdir = $(exec_prefix)/lib
  177.      # Where to put the Info files.
  178.      infodir = $(prefix)/info
  179.    If your program installs a large number of files into one of the
  180. standard user-specified directories, it might be useful to group them
  181. into a subdirectory particular to that program.  If you do this, you
  182. should write the `install' rule to create these subdirectories.
  183.    Do not expect the user to include the subdirectory name in the value
  184. of any of the variables listed above.  The idea of having a uniform set
  185. of variable names for installation directories is to enable the user to
  186. specify the exact same values for several different GNU packages.  In
  187. order for this to be useful, all the packages must be designed so that
  188. they will work sensibly when the user does so.
  189. File: make.info,  Node: Quick Reference,  Next: Complex Makefile,  Prev: Makefile Conventions,  Up: Top
  190. Quick Reference
  191. ***************
  192.    This appendix summarizes the directives, text manipulation functions,
  193. and special variables which GNU `make' understands.  *Note Special
  194. Targets::, *Note Catalogue of Implicit Rules: Catalogue of Rules, and
  195. *Note Summary of Options: Options Summary.  for other summaries.
  196.    Here is a summary of the directives GNU `make' recognizes:
  197. `define VARIABLE'
  198. `endef'
  199.      Define a multi-line, recursively-expanded variable.
  200.      *Note Sequences::.
  201. `ifdef VARIABLE'
  202. `ifndef VARIABLE'
  203. `ifeq (A,B)'
  204. `ifeq "A" "B"'
  205. `ifeq 'A' 'B''
  206. `ifneq (A,B)'
  207. `ifneq "A" "B"'
  208. `ifneq 'A' 'B''
  209. `else'
  210. `endif'
  211.      Conditionally evaluate part of the makefile.
  212.      *Note Conditionals::.
  213. `include FILE'
  214.      Include another makefile.
  215.      *Note Including Other Makefiles: Include.
  216. `override VARIABLE = VALUE'
  217. `override VARIABLE := VALUE'
  218. `override VARIABLE += VALUE'
  219. `override define VARIABLE'
  220. `endef'
  221.      Define a variable, overriding any previous definition, even one
  222.      from the command line.
  223.      *Note The `override' Directive: Override Directive.
  224. `export'
  225.      Tell `make' to export all variables to child processes by default.
  226.      *Note Communicating Variables to a Sub-`make': Variables/Recursion.
  227. `export VARIABLE'
  228. `export VARIABLE = VALUE'
  229. `export VARIABLE := VALUE'
  230. `export VARIABLE += VALUE'
  231. `unexport VARIABLE'
  232.      Tell `make' whether or not to export a particular variable to child
  233.      processes.
  234.      *Note Communicating Variables to a Sub-`make': Variables/Recursion.
  235. `vpath PATTERN PATH'
  236.      Specify a search path for files matching a `%' pattern.
  237.      *Note The `vpath' Directive: Selective Search.
  238. `vpath PATTERN'
  239.      Remove all search paths previously specified for PATTERN.
  240. `vpath'
  241.      Remove all search paths previously specified in any `vpath'
  242.      directive.
  243.    Here is a summary of the text manipulation functions (*note
  244. Functions::.):
  245. `$(subst FROM,TO,TEXT)'
  246.      Replace FROM with TO in TEXT.
  247.      *Note Functions for String Substitution and Analysis: Text
  248.      Functions.
  249. `$(patsubst PATTERN,REPLACEMENT,TEXT)'
  250.      Replace words matching PATTERN with REPLACEMENT in TEXT.
  251.      *Note Functions for String Substitution and Analysis: Text
  252.      Functions.
  253. `$(strip STRING)'
  254.      Remove excess whitespace characters from STRING.
  255.      *Note Functions for String Substitution and Analysis: Text
  256.      Functions.
  257. `$(findstring FIND,TEXT)'
  258.      Locate FIND in TEXT.
  259.      *Note Functions for String Substitution and Analysis: Text
  260.      Functions.
  261. `$(filter PATTERN...,TEXT)'
  262.      Select words in TEXT that match one of the PATTERN words.
  263.      *Note Functions for String Substitution and Analysis: Text
  264.      Functions.
  265. `$(filter-out PATTERN...,TEXT)'
  266.      Select words in TEXT that *do not* match any of the PATTERN words.
  267.      *Note Functions for String Substitution and Analysis: Text
  268.      Functions.
  269. `$(sort LIST)'
  270.      Sort the words in LIST lexicographically, removing duplicates.
  271.      *Note Functions for String Substitution and Analysis: Text
  272.      Functions.
  273. `$(dir NAMES...)'
  274.      Extract the directory part of each file name.
  275.      *Note Functions for File Names: Filename Functions.
  276. `$(notdir NAMES...)'
  277.      Extract the non-directory part of each file name.
  278.      *Note Functions for File Names: Filename Functions.
  279. `$(suffix NAMES...)'
  280.      Extract the suffix (the last `.' and following characters) of each
  281.      file name.
  282.      *Note Functions for File Names: Filename Functions.
  283. `$(basename NAMES...)'
  284.      Extract the base name (name without suffix) of each file name.
  285.      *Note Functions for File Names: Filename Functions.
  286. `$(addsuffix SUFFIX,NAMES...)'
  287.      Append SUFFIX to each word in NAMES.
  288.      *Note Functions for File Names: Filename Functions.
  289. `$(addprefix PREFIX,NAMES...)'
  290.      Prepend PREFIX to each word in NAMES.
  291.      *Note Functions for File Names: Filename Functions.
  292. `$(join LIST1,LIST2)'
  293.      Join two parallel lists of words.
  294.      *Note Functions for File Names: Filename Functions.
  295. `$(word N,TEXT)'
  296.      Extract the Nth word (one-origin) of TEXT.
  297.      *Note Functions for File Names: Filename Functions.
  298. `$(words TEXT)'
  299.      Count the number of words in TEXT.
  300.      *Note Functions for File Names: Filename Functions.
  301. `$(firstword NAMES...)'
  302.      Extract the first word of NAMES.
  303.      *Note Functions for File Names: Filename Functions.
  304. `$(wildcard PATTERN...)'
  305.      Find file names matching a shell file name pattern (*not* a `%'
  306.      pattern).
  307.      *Note The Function `wildcard': Wildcard Function.
  308. `$(shell COMMAND)'
  309.      Execute a shell command and return its output.
  310.      *Note The `shell' Function: Shell Function.
  311. `$(origin VARIABLE)'
  312.      Return a string describing how the `make' variable VARIABLE was
  313.      defined.
  314.      *Note The `origin' Function: Origin Function.
  315. `$(foreach VAR,WORDS,TEXT)'
  316.      Evaluate TEXT with VAR bound to each word in WORDS, and
  317.      concatenate the results.
  318.      *Note The `foreach' Function: Foreach Function.
  319.    Here is a summary of the automatic variables.  *Note Automatic
  320. Variables: Automatic, for full information.
  321.      The file name of the target.
  322.      The target member name, when the target is an archive member.
  323.      The name of the first dependency.
  324.      The names of all the dependencies that are newer than the target,
  325.      with spaces between them.  For dependencies which are archive
  326.      members, only the member named is used (*note Archives::.).
  327.      The names of all the dependencies, with spaces between them.  For
  328.      dependencies which are archive members, only the member named is
  329.      used (*note Archives::.).
  330.      The stem with which an implicit rule matches (*note How Patterns
  331.      Match: Pattern Match.).
  332. `$(@D)'
  333. `$(@F)'
  334.      The directory part and the file-within-directory part of `$@'.
  335. `$(*D)'
  336. `$(*F)'
  337.      The directory part and the file-within-directory part of `$*'.
  338. `$(%D)'
  339. `$(%F)'
  340.      The directory part and the file-within-directory part of `$%'.
  341. `$(<D)'
  342. `$(<F)'
  343.      The directory part and the file-within-directory part of `$<'.
  344. `$(^D)'
  345. `$(^F)'
  346.      The directory part and the file-within-directory part of `$^'.
  347. `$(?D)'
  348. `$(?F)'
  349.      The directory part and the file-within-directory part of `$?'.
  350.    These variables are used specially by GNU `make':
  351. `MAKEFILES'
  352.      Makefiles to be read on every invocation of `make'.
  353.      *Note The Variable `MAKEFILES': MAKEFILES Variable.
  354. `VPATH'
  355.      Directory search path for files not found in the current directory.
  356.      *Note `VPATH' Search Path for All Dependencies: General Search.
  357. `SHELL'
  358.      The name of the system default command interpreter, usually
  359.      `/bin/sh'.  You can set `SHELL' in the makefile to change the
  360.      shell used to run commands.  *Note Command Execution: Execution.
  361. `MAKE'
  362.      The name with which `make' was invoked.  Using this variable in
  363.      commands has special meaning.  *Note How the `MAKE' Variable
  364.      Works: MAKE Variable.
  365. `MAKELEVEL'
  366.      The number of levels of recursion (sub-`make's).
  367.      *Note Variables/Recursion::.
  368. `MAKEFLAGS'
  369. `MFLAGS'
  370.      The flags given to `make'.  You can set this in the environment or
  371.      a makefile to set flags.
  372.      *Note Communicating Options to a Sub-`make': Options/Recursion.
  373. `SUFFIXES'
  374.      The default list of suffixes before `make' reads any makefiles.
  375. File: make.info,  Node: Complex Makefile,  Next: Concept Index,  Prev: Quick Reference,  Up: Top
  376. Complex Makefile Example
  377. ************************
  378.    Here is the makefile for the GNU `tar' program.  This is a
  379. moderately complex makefile.
  380.    Because it is the first target, the default goal is `all'.  An
  381. interesting feature of this makefile is that `testpad.h' is a source
  382. file automatically created by the `testpad' program, itself compiled
  383. from `testpad.c'.
  384.    If you type `make' or `make all', then `make' creates the `tar'
  385. executable, the `rmt' daemon that provides remote tape access, and the
  386. `tar.info' Info file.
  387.    If you type `make install', then `make' not only creates `tar',
  388. `rmt', and `tar.info', but also installs them.
  389.    If you type `make clean', then `make' removes the `.o' files, and
  390. the `tar', `rmt', `testpad', `testpad.h', and `core' files.
  391.    If you type `make distclean', then `make' not only removes the same
  392. files as does `make clean' but also the `TAGS', `Makefile', and
  393. `config.status' files.  (Although it is not evident, this makefile (and
  394. `config.status') is generated by the user with the `configure' program,
  395. which is provided in the `tar' distribution, but is not shown here.)
  396.    If you type `make realclean', then `make' removes the same files as
  397. does `make distclean' and also removes the Info files generated from
  398. `tar.texinfo'.
  399.    In addition, there are targets `shar' and `dist' that create
  400. distribution kits.
  401.      # Generated automatically from Makefile.in by configure.
  402.      # Un*x Makefile for GNU tar program.
  403.      # Copyright (C) 1991 Free Software Foundation, Inc.
  404.      
  405.      # This program is free software; you can redistribute
  406.      # it and/or modify it under the terms of the GNU
  407.      # General Public License ...
  408.      ...
  409.      ...
  410.      
  411.      SHELL = /bin/sh
  412.      
  413.      #### Start of system configuration section. ####
  414.      
  415.      srcdir = .
  416.      
  417.      # If you use gcc, you should either run the
  418.      # fixincludes script that comes with it or else use
  419.      # gcc with the -traditional option.  Otherwise ioctl
  420.      # calls will be compiled incorrectly on some systems.
  421.      CC = gcc -O
  422.      YACC = bison -y
  423.      INSTALL = /usr/local/bin/install -c
  424.      INSTALLDATA = /usr/local/bin/install -c -m 644
  425.      
  426.      # Things you might add to DEFS:
  427.      # -DSTDC_HEADERS        If you have ANSI C headers and
  428.      #                       libraries.
  429.      # -DPOSIX               If you have POSIX.1 headers and
  430.      #                       libraries.
  431.      # -DBSD42               If you have sys/dir.h (unless
  432.      #                       you use -DPOSIX), sys/file.h,
  433.      #                       and st_blocks in `struct stat'.
  434.      # -DUSG                 If you have System V/ANSI C
  435.      #                       string and memory functions
  436.      #                       and headers, sys/sysmacros.h,
  437.      #                       fcntl.h, getcwd, no valloc,
  438.      #                       and ndir.h (unless
  439.      #                       you use -DDIRENT).
  440.      # -DNO_MEMORY_H         If USG or STDC_HEADERS but do not
  441.      #                       include memory.h.
  442.      # -DDIRENT              If USG and you have dirent.h
  443.      #                       instead of ndir.h.
  444.      # -DSIGTYPE=int         If your signal handlers
  445.      #                       return int, not void.
  446.      # -DNO_MTIO             If you lack sys/mtio.h
  447.      #                       (magtape ioctls).
  448.      # -DNO_REMOTE           If you do not have a remote shell
  449.      #                       or rexec.
  450.      # -DUSE_REXEC           To use rexec for remote tape
  451.      #                       operations instead of
  452.      #                       forking rsh or remsh.
  453.      # -DVPRINTF_MISSING     If you lack vprintf function
  454.      #                       (but have _doprnt).
  455.      # -DDOPRNT_MISSING      If you lack _doprnt function.
  456.      #                       Also need to define
  457.      #                       -DVPRINTF_MISSING.
  458.      # -DFTIME_MISSING       If you lack ftime system call.
  459.      # -DSTRSTR_MISSING      If you lack strstr function.
  460.      # -DVALLOC_MISSING      If you lack valloc function.
  461.      # -DMKDIR_MISSING       If you lack mkdir and
  462.      #                       rmdir system calls.
  463.      # -DRENAME_MISSING      If you lack rename system call.
  464.      # -DFTRUNCATE_MISSING   If you lack frtruncate
  465.      #                       system call.
  466.      # -DV7                  On Version 7 Unix (not
  467.      #                       tested in a long time).
  468.      # -DEMUL_OPEN3          If you lack a 3-argument version
  469.      #                       of open, and want to emulate it
  470.      #                       with system calls you do have.
  471.      # -DNO_OPEN3            If you lack the 3-argument open
  472.      #                       and want to disable the tar -k
  473.      #                       option instead of emulating open.
  474.      # -DXENIX               If you have sys/inode.h
  475.      #                       and need it 94 to be included.
  476.      
  477.      DEFS =  -DSIGTYPE=int -DDIRENT -DSTRSTR_MISSING \
  478.              -DVPRINTF_MISSING -DBSD42
  479.      # Set this to rtapelib.o unless you defined NO_REMOTE,
  480.      # in which case make it empty.
  481.      RTAPELIB = rtapelib.o
  482.      LIBS =
  483.      DEF_AR_FILE = /dev/rmt8
  484.      DEFBLOCKING = 20
  485.      
  486.      CDEBUG = -g
  487.      CFLAGS = $(CDEBUG) -I. -I$(srcdir) $(DEFS) \
  488.              -DDEF_AR_FILE=\"$(DEF_AR_FILE)\" \
  489.              -DDEFBLOCKING=$(DEFBLOCKING)
  490.      LDFLAGS = -g
  491.      
  492.      prefix = /usr/local
  493.      # Prefix for each installed program,
  494.      # normally empty or `g'.
  495.      binprefix =
  496.      
  497.      # The directory to install tar in.
  498.      bindir = $(prefix)/bin
  499.      
  500.      # The directory to install the info files in.
  501.      infodir = $(prefix)/info
  502.      
  503.      #### End of system configuration section. ####
  504.      
  505.      SRC1 =  tar.c create.c extract.c buffer.c \
  506.              getoldopt.c update.c gnu.c mangle.c
  507.      SRC2 =  version.c list.c names.c diffarch.c \
  508.              port.c wildmat.c getopt.c
  509.      SRC3 =  getopt1.c regex.c getdate.y
  510.      SRCS =  $(SRC1) $(SRC2) $(SRC3)
  511.      OBJ1 =  tar.o create.o extract.o buffer.o \
  512.              getoldopt.o update.o gnu.o mangle.o
  513.      OBJ2 =  version.o list.o names.o diffarch.o \
  514.              port.o wildmat.o getopt.o
  515.      OBJ3 =  getopt1.o regex.o getdate.o $(RTAPELIB)
  516.      OBJS =  $(OBJ1) $(OBJ2) $(OBJ3)
  517.      AUX =   README COPYING ChangeLog Makefile.in  \
  518.              makefile.pc configure configure.in \
  519.              tar.texinfo tar.info* texinfo.tex \
  520.              tar.h port.h open3.h getopt.h regex.h \
  521.              rmt.h rmt.c rtapelib.c alloca.c \
  522.              msd_dir.h msd_dir.c tcexparg.c \
  523.              level-0 level-1 backup-specs testpad.c
  524.      
  525.      all:    tar rmt tar.info
  526.      
  527.      tar:    $(OBJS)
  528.              $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  529.      
  530.      rmt:    rmt.c
  531.              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rmt.c
  532.      
  533.      tar.info: tar.texinfo
  534.              makeinfo tar.texinfo
  535.      
  536.      install: all
  537.              $(INSTALL) tar $(bindir)/$(binprefix)tar
  538.              -test ! -f rmt || $(INSTALL) rmt /etc/rmt
  539.              $(INSTALLDATA) $(srcdir)/tar.info* $(infodir)
  540.      
  541.      $(OBJS): tar.h port.h testpad.h
  542.      regex.o buffer.o tar.o: regex.h
  543.      # getdate.y has 8 shift/reduce conflicts.
  544.      
  545.      testpad.h: testpad
  546.              ./testpad
  547.      
  548.      testpad: testpad.o
  549.              $(CC) -o $@ testpad.o
  550.      
  551.      TAGS:   $(SRCS)
  552.              etags $(SRCS)
  553.      
  554.      clean:
  555.              rm -f *.o tar rmt testpad testpad.h core
  556.      
  557.      distclean: clean
  558.              rm -f TAGS Makefile config.status
  559.      
  560.      realclean: distclean
  561.              rm -f tar.info*
  562.      
  563.      shar: $(SRCS) $(AUX)
  564.              shar $(SRCS) $(AUX) | compress \
  565.                > tar-`sed -e '/version_string/!d' \
  566.                           -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
  567.                           -e q
  568.                           version.c`.shar.Z
  569.      
  570.      dist: $(SRCS) $(AUX)
  571.              echo tar-`sed \
  572.                   -e '/version_string/!d' \
  573.                   -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
  574.                   -e q
  575.                   version.c` > .fname
  576.              -rm -rf `cat .fname`
  577.              mkdir `cat .fname`
  578.              ln $(SRCS) $(AUX) `cat .fname`
  579.              -rm -rf `cat .fname` .fname
  580.              tar chZf `cat .fname`.tar.Z `cat .fname`
  581.      
  582.      tar.zoo: $(SRCS) $(AUX)
  583.              -rm -rf tmp.dir
  584.              -mkdir tmp.dir
  585.              -rm tar.zoo
  586.              for X in $(SRCS) $(AUX) ; do \
  587.                  echo $$X ; \
  588.                  sed 's/$$/^M/' $$X \
  589.                  > tmp.dir/$$X ; done
  590.              cd tmp.dir ; zoo aM ../tar.zoo *
  591.              -rm -rf tmp.dir
  592.